package com.zsx.shopping.product.converter;

import com.zsx.shopping.common.api.product.vo.SkuAttrVO;
import com.zsx.shopping.common.api.search.dto.SkuEsDto;
import com.zsx.shopping.product.entity.SkuAttr;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface SkuAttrConverter {

    SkuAttrVO toSkuAttrVO(SkuAttr skuAttr);

    List<SkuAttrVO> toSkuAttrVOs(List<SkuAttr> skuAttrs);

    @Mappings({
            @Mapping(target = "id", source = "attrId"),
            @Mapping(target = "name", source = "attrName"),
            @Mapping(target = "value", source = "attrValue")
    })
    SkuEsDto.Attr toSkuEsDTOAttr(SkuAttr skuAttr);
}
